// Copyright (c) Microsoft Corporation. All rights reserved.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class sample112 : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        sourceCode.Text = @"public void LinqToEntities77()<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;var query = context<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Products<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Select(p => p);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;// we need ToList to force execution, as GetType is not defined in store<br>&nbsp;&nbsp;&nbsp;&nbsp;var query2 = query<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.ToList()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Select(p => new { type = p.GetType().ToString(), prod = p });<br><br>&nbsp;&nbsp;&nbsp;&nbsp;ObjectDumper.Write(query2);<br>}<br>";
    }

    public void ExecuteQuery(object src, EventArgs e)
    {
        using (context = new EntityNorthwind.EntityNorthwindContext(connstr))
        {
            LinqToEntities77();
        }
        this.output.Text = QueryOutput();
    }

	public void LinqToEntities77()
{
    var query = context
        .Products
        .Select(p => p);

    // we need ToList to force execution, as GetType is not defined in store
    var query2 = query
        .ToList()
        .Select(p => new { type = p.GetType().ToString(), prod = p });

    ObjectDumper.Write(query2);
}

}
